import { useRoutes, RouteObject, Navigate } from "react-router-dom";
import Layout from "../views/layout";
import Login from "../views/login";
import User from "../views/user";

const Router = () => {
  const element:RouteObject[] = useRoutes([
    {
      path: "/",
      element: <Navigate replace to="/layout/user" />,
    },
    {
      path: "/layout",
      element: <Layout />,
      children: [
        { path: "login", element: <Login /> },
        { path: "user", element: <User /> },
      ],
    },
  ]);

  return element;
};

export default Router;
